//
//  ShapeLayerUtil.swift
//  Extend
//
//  Created by 陆海升 on 2018/3/16.
//  Copyright © 2018年 敬信. All rights reserved.
//

import Foundation
//import QuartzCore

public extension CAShapeLayer {
    public class func setViewCorner(_ view: UIView, radius: CGFloat, lineWidth: CGFloat, dashPatterns: Array<Any>, strokeColor: UIColor) -> CAShapeLayer {
        let layer = CAShapeLayer.init()
        layer.frame = CGRect.init(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height)
        layer.backgroundColor = UIColor.clear.cgColor
        
        let path = UIBezierPath.init(roundedRect: layer.frame, cornerRadius: radius)
        layer.path = path.cgPath
        layer.lineWidth = lineWidth
        layer.lineDashPattern = dashPatterns as? [NSNumber]
        layer.fillColor = UIColor.clear.cgColor
        layer.strokeColor = strokeColor.cgColor
        return layer
    }
}
